package system.config;

import framework.captcha.Captcha;
import framework.captcha.CaptchaBase;
import framework.captcha.CaptchaServlet;
import framework.captcha.CaptchaSimple;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CaptchaConfig {
    /**
     * 创建新验证服务
     *
     * @param cacheManager
     * @return
     */
    @Bean
    public Captcha captcha(CacheManager cacheManager) {
        Cache cache = cacheManager.getCache("Captcha");
        Captcha captcha = new CaptchaBase(cache);
        return captcha;
    }
}
